﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdEdCommandStack : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdEdCommandStack(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdEdCommandStack_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdEdCommandStack obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdEdCommandStack()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdEdCommandStack(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdEdCommandStack cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_cast(OdRxObject.getCPtr(pObj));
			OdEdCommandStack result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStack_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStack_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStack_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdEdCommandStack createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_createObject();
			OdEdCommandStack result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommandStack)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void addReactor(OdEdCommandStackReactor pReactor)
		{
			GlobalsPINVOKE.OdEdCommandStack_addReactor(this.swigCPtr, OdEdCommandStackReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeReactor(OdEdCommandStackReactor pReactor)
		{
			GlobalsPINVOKE.OdEdCommandStack_removeReactor(this.swigCPtr, OdEdCommandStackReactor.getCPtr(pReactor));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdEdCommandStackReactorArray getCommandStackReactors()
		{
			OdEdCommandStackReactorArray result = new OdEdCommandStackReactorArray(GlobalsPINVOKE.OdEdCommandStack_getCommandStackReactors(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void addCommand(OdEdCommand pCommand)
		{
			GlobalsPINVOKE.OdEdCommandStack_addCommand__SWIG_0(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdEdCommand addCommand(string sGroupName, string sGlobalName, string sLocalName, uint commandFlags, OdEdCommandFunctionDelegate pFunction, OdRxModule pModule)
		{
			OdEdCommand result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStack_addCommand__SWIG_1(this.swigCPtr, sGroupName, sGlobalName, sLocalName, commandFlags, pFunction, OdRxModule.getCPtr(pModule)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdEdCommand addCommand(string sGroupName, string sGlobalName, string sLocalName, uint commandFlags, OdEdCommandFunctionDelegate pFunction)
		{
			OdEdCommand result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdEdCommandStack_addCommand__SWIG_2(this.swigCPtr, sGroupName, sGlobalName, sLocalName, commandFlags, pFunction), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdRxIterator newIterator()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_newIterator__SWIG_0(this.swigCPtr);
			OdRxIterator result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdRxIterator newIterator(string groupName)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_newIterator__SWIG_1(this.swigCPtr, groupName);
			OdRxIterator result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdRxIterator newGroupIterator()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_newGroupIterator(this.swigCPtr);
			OdRxIterator result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdRxIterator)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdEdCommand lookupCmd(string commandName, int lookupFlags, string groupName)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_lookupCmd__SWIG_0(this.swigCPtr, commandName, lookupFlags, groupName);
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdEdCommand lookupCmd(string commandName, int lookupFlags)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_lookupCmd__SWIG_1(this.swigCPtr, commandName, lookupFlags);
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdEdCommand lookupCmd(string commandName)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdEdCommandStack_lookupCmd__SWIG_2(this.swigCPtr, commandName);
			OdEdCommand result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdEdCommand)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void executeCommand(OdEdCommand pCmd, OdEdCommandContext pCmdCtx)
		{
			GlobalsPINVOKE.OdEdCommandStack_executeCommand__SWIG_0(this.swigCPtr, OdEdCommand.getCPtr(pCmd), OdEdCommandContext.getCPtr(pCmdCtx));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void executeCommand(string cmdName, OdEdCommandContext pCmdCtx, int lookupFlags, string groupName)
		{
			GlobalsPINVOKE.OdEdCommandStack_executeCommand__SWIG_1(this.swigCPtr, cmdName, OdEdCommandContext.getCPtr(pCmdCtx), lookupFlags, groupName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void executeCommand(string cmdName, OdEdCommandContext pCmdCtx, int lookupFlags)
		{
			GlobalsPINVOKE.OdEdCommandStack_executeCommand__SWIG_2(this.swigCPtr, cmdName, OdEdCommandContext.getCPtr(pCmdCtx), lookupFlags);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void executeCommand(string cmdName, OdEdCommandContext pCmdCtx)
		{
			GlobalsPINVOKE.OdEdCommandStack_executeCommand__SWIG_3(this.swigCPtr, cmdName, OdEdCommandContext.getCPtr(pCmdCtx));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeCmd(string groupName, string globalName)
		{
			GlobalsPINVOKE.OdEdCommandStack_removeCmd__SWIG_0(this.swigCPtr, groupName, globalName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeCmd(OdEdCommand pCommand)
		{
			GlobalsPINVOKE.OdEdCommandStack_removeCmd__SWIG_1(this.swigCPtr, OdEdCommand.getCPtr(pCommand));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void removeGroup(string groupName)
		{
			GlobalsPINVOKE.OdEdCommandStack_removeGroup(this.swigCPtr, groupName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdResult popGroupToTop(string cmdGroupName)
		{
			OdResult result = (OdResult)GlobalsPINVOKE.OdEdCommandStack_popGroupToTop(this.swigCPtr, cmdGroupName);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		public enum LookupFlags
		{
			kGlobal = 1,
			kLocal,
			kSpecifedGroup = 4,
			kUndefed = 8
		}
	}
}
